package com.jd.nb.interceptor;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by lantianixang1 on 2018/8/1.
 **/
public class TestInterceptor extends HandlerInterceptorAdapter {
    /*
    * 测试拦截器中往ModelAndView中设置值后，再进入业务逻辑后拦截器中设置的值仍然有效
    * posthandle在调用controller后才会被调用
    * */
    @Override
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
        modelAndView.addObject("info", "test the diff between modelAndView and model");
    }

}
